package fr.labri.macchiato.ui.preferences;

import com.smartgwt.client.widgets.Window;

import fr.labri.macchiato.core.model.UserPreferences;

/**
 * 
 * @author Michelle AVOMO
 * 
 *         Interface that implements all the methods in order to save and
 *         restore the user preferences and manage when to display and hide the
 *         previous and next widget into a given list.
 */

public interface PreferencesWidget {
	
	/**
	 * 
	 * @return the title of the widget
	 */
	public String getTitle();

	/**
	 * Shows the widget
	 */
	public void show();

	/**
	 * Hides the widget
	 */
	public void hide();

	/**
	 * removes the widget from his parent
	 */
	public void removeFromParent();

	/**
	 * Adds the widget to a parent
	 * 
	 * @param preference
	 */
	public void addToParent(Window preference);

	/**
	 * Adds to the userPreferences the informations displayed by this widget
	 * 
	 * @param preference
	 */
	public void collectUserPreferences(UserPreferences preference);

	/**
	 * 
	 * @return Is the form properly filled by the user?
	 */
	public Boolean isValid();

	/**
	 * Fill in the widget with informations from the user preferences
	 * 
	 * @param preferences
	 */
	public void restoreUserPreferences(UserPreferences preferences);

}
